package com.yuandian.management.enums;

/**
 * @author liXin
 * @description 过滤规则
 * @date 2020/6/1
 */
public enum ProbeFilterSyncEnum {
    /**
     * 同步状态
     */
    NOT_SYNC(0, "未同步"),
    NOW_SYNC(1, "正在同步"),
    OK_SYNC(2, "同步成功"),
    FAILE_SYNC(3, "同步失败"),
    /**
     * 规则执行结果
     */
    NOT_EXECUTE(0, "未执行"),
    IN_EXECUTE(1, "执行中"),
    OK_EXECUTE(2, "执行完成"),
    /**
     *停用启用
     */
    STOP(0, "禁用"),
    START(1, "启用"),

    /**
     * 过滤规则 同步后,实时流需要进行的操作枚举
     */
    NOTHING(0, "不做任何处理"),
    DEL_ALL(1, "删除所有的数据"),
    DEL_LOCAL_RULE(2, "仅移除本地规则,缓存入库"),
    ADD_LOCAL_RULE(3, "增加本地规则"),
    DEL_FILTER(4, "做删除规则操作"),
    DEL_COUNTER(5, "执行完成,移除计数器");

    private Integer type;
    private String desc;

    /**
     * 获取key
     */
    public static Integer getType(String key) {
        ProbeFilterSyncEnum[] enums = ProbeFilterSyncEnum.values();
        for (ProbeFilterSyncEnum anEnum : enums) {
            if (anEnum.desc.equals(key)){
                return anEnum.getType();
            }
        }
		throw new IllegalArgumentException("Invalid enum Code: " + key);
    }


    ProbeFilterSyncEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }
    public Integer getType() {
        return type;
    }
    public String getDesc() {
        return desc;
    }

}
